package cn.bdqn.hospital.vo;

import java.io.Serializable;
import java.util.List;

public class Page<T> implements Serializable {
    private int pageNo;// 页码
    private int pageSize;// 每页数量
    private int count;// 总数
    private int pageCount;// 总页数
    private List<T> list; // 当前页码的数据集合

    public Page(){

    }

    public Page(int pageNo,int pageSize){
        this.pageNo = pageNo;
        this.pageSize = pageSize;
    }

    public int getPageNo() {
        return pageNo;
    }

    public void setPageNo(int pageNo) {
        this.pageNo = pageNo;
    }

    public int getPageSize() {
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }

    public int getCount() {
        return count;
    }

    public void setCount(int count) {
        this.count = count;
        if (count > 0) {
            //计算总页数
            pageCount = (this.count % pageSize == 0) ?
                    (this.count / pageSize) :
                    ((this.count / pageSize) + 1);
        }

    }

    public int getPageCount() {
        return pageCount;
    }

    public List<T> getList() {
        return list;
    }

    public void setList(List<T> list) {
        this.list = list;
    }

    @Override
    public String toString() {
        return "Page{" +
                "pageNo=" + pageNo +
                ", pageSize=" + pageSize +
                ", count=" + count +
                ", pageCount=" + pageCount +
                ", list=" + list +
                '}';
    }
}
